<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.ResultSet" %>
<%@ page import="java.sql.Statement" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
</head>
<body>
<center>
<form>
    输入查询条件：<input type="text">
    <input type="submit" value="查询">
</form>
    <table border="1px">
        <tr>
            <td>学号</td>
            <td>姓名</td>
            <td>班级</td>
        </tr>
        <%

            //1、加载驱动（找桥梁的开发商）
            Class.forName("org.sqlite.JDBC");
            //2、获取连接（架桥梁）
            Connection conn = DriverManager.getConnection(
                    "jdbc:sqlite:/Users/zhli/Desktop/test.db");
            //3、获取执行对象（找卡车）
            Statement stmt = conn.createStatement();
            //4、创键sql命令（给司机下指令）
            String sql = "select * from t_user";
            //5、执行命令（司机去拉货）
            ResultSet rs = stmt.executeQuery(sql);
            //6、处理结果集（卸货）
            while (rs.next()) {
                out.print("<tr>");
                out.print("<td>");
                out.print(rs.getString("username"));
                out.print("</td>");
                out.print("<td>");
                out.print(rs.getString("name"));
                out.print("</td>");
                out.print("<td>");
                out.print(rs.getString("clazz"));
                out.print("</td>");
                out.print("</tr>");
            }
            //7、关闭资源（卸磨杀驴）
            conn.close();
        %>
    </table>
</center>
</body>
</html>

<%--MySQL:
驱动名称：com.mysql.jdbc.Driver
连接字符串：jdbc:mysql://127.0.0.1:3306/12006242601

SQL Server:
驱动名称：com.microsoft.sqlserver.jdbc.SQLServerDriver
连接字符串：jdbc:sqlserver://127.0.0.1:1433;DatabaseName=12006242601

Oracle:
驱动名称：oracle.jdbc.driver.OracleDriver
连接字符串：jdbc:oracle:thin:@127.0.0.1:1521:ZHLI2008

SQLite:
驱动名称：org.sqlite.JDBC
连接字符串：jdbc:sqlite:c:/12006242601.db
--%>


